layui.define(['table', 'form', 'element'], function(exports){
  var $ = layui.$,table = layui.table,form = layui.form, element = layui.element;
  
  form.on('submit(LAY-update-dbConfig)', function (data) {
      var field = data.field;
      $.ajax({
          type: "post",
          url: layui.setter.webRoot + "/market/cloud/supplier/db_config/save.do",
          data: field,
          dataType: "json",
          success: function (res) {
              if (res.code == 200) {
                  layer.msg('修改成功', {icon: 1});
              } else {
                  layer.msg(res.msg, {icon: 2});
              }
          }
      });
  });

  form.on('submit(LAY-save)', function (data) {
      var field = data.field;
      $.ajax({
          type: "post",
          url: layui.setter.webRoot + "/market/cloud/supplier/update.do",
          data: field,
          dataType: "json",
          success: function (res) {
              if (res.code == 200) {
                  layer.msg('修改成功', {icon: 1});
              } else {
                  layer.msg(res.msg, {icon: 2});
              }
          }
      });
  });

  exports('market_supplier_info', {})
});